<?php
include("connection/connection.php");
if(isset($_POST['submit']))
{
$frm=$_POST['sch_id'];
$scheme_name=$_POST['scheme_name'];
$YOC=$_POST['YOC'];
$CC=$_POST['CC'];
$type_scheme=$_POST['type_scheme'];
if($_POST['scheme_sactioned']!='Other')
		{
			$scheme_sactioned=$_POST['scheme_sactioned'];
		}
		else
		{
			$scheme_sactioned=$_POST['scheme_sactioned_other'];
		}

$qr="update tbl_dtls_q1_main set type_scheme='$type_scheme',name_scheme='$scheme_name',year_comm='$YOC',capital_cost='$CC',scheme_sactioned='$scheme_sactioned' where id='$frm'";
$res=mysql_query($qr);
////////////////////////code for maintaining user history///////////////////
if($type_scheme=="P&T" || $type_scheme=="TSS(P&T)")
{
	$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','1','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
}
if($type_scheme=="Piped")
{
	$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','27','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
}
if($type_scheme=="Sanitary Diggs")
{
	$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','53','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
}


mysql_query($qryHistory);
///////////////////////////////


if($res)
{
header("location:q1.php");
}
}
?>